﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="StuView.aspx.cs" Inherits="Student_Report_StuView" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <link href="../../Common/css/main.css" rel="stylesheet" type="text/css" />
         <script type="text/javascript" src="../../Common/js/jquery.js"></script>
    <script type="text/javascript" src="../../Common/js/common.js"></script>
    <script type="text/javascript" src="../../Common/js/msg.js"></script>  
</head>
<script language="javascript">
    var exams = new Array();
    var schoolYear = Array();
    
        //学年选择事件
    function onYearSelect(va)
    {
        var evsel = document.getElementById('examSelect');
        //重新初始化评估列表
        for(var i=evsel.length-1;i>=0;i--)
        {
            evsel.options.remove(i);
        }
        for(var j=0;j<exams.length;j++)
        {
            if(exams[j].schoolYear==va)
            {
                var temp = document.createElement("OPTION");
                temp.text=exams[j].examName;
                temp.value=exams[j].examID;
                temp.examType=exams[j].examType;
                temp.schoolYear=exams[j].schoolYear;
                temp.grade=exams[j].grade;
                temp.ClassType=exams[j].ClassType;
                evsel.add(temp);
            }
        }
//        //执行其他回调
//        if(funYearChange != null) {
//            funYearChange();
//        }
    }
    function getExamID()
    {
        var evsel = document.getElementById('examSelect');
        if(evsel.selectedIndex!=-1)
            return evsel.options[evsel.selectedIndex].value;
        return "";
    }
    function OnSelectView()
    {
        var evsel = document.getElementById('examSelect');
        if(evsel.selectedIndex!=-1)
        {
            document.getElementById('Textiseexam').value = evsel.options[evsel.selectedIndex].examType;
            document.getElementById('Textid').value = evsel.options[evsel.selectedIndex].value;
            document.getElementById('Textg').value = evsel.options[evsel.selectedIndex].grade;  
            document.getElementById('TextName').value = evsel.options[evsel.selectedIndex].text;
            document.getElementById('TextClassType').value = evsel.options[evsel.selectedIndex].ClassType;
            document.getElementById('btnBind').click();
        }
    }
</script>
<body>
    <form id="form1" runat="server">

        <div class="mainWarp">
            <div class="pageBody" style="padding-top=5px;padding-left=5px;">
        <div>
        学年：<select id="yearSelect" style="width: 92px" onchange="onYearSelect(this.options[this.selectedIndex].value)">
        </select>
        考试：<select id="examSelect" style="width: 155px">
        </select>
        <input id="Button1" type="button" value="查询" class="commonBut" onclick="OnSelectView()"/>
                    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
                    </asp:ScriptManager>
                    &nbsp;
                </div>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                    <h4><asp:Label ID="Label1" runat="server" Text=""></asp:Label></h4>
                        <asp:Repeater ID="Repeater1" runat="server">
                            <HeaderTemplate>
                                <table id="settingTable" border="0" cellpadding="0" cellspacing="1"  style="width:800px;" class="useList">
                                        <%= GetHeader()%>
                            </HeaderTemplate>
                            <ItemTemplate>
                                
                                    <%# GetStudent()%>
                                
                            </ItemTemplate>
                            <FooterTemplate>
                                </table>
                            </FooterTemplate>
                        </asp:Repeater>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnBind" EventName="Click" />
                    </Triggers>
                </asp:UpdatePanel>
                <div style="display: none;">
                  <asp:Button ID="btnBind" runat="server" OnClick="btnBind_Click" Text="btnBind" />
                    <asp:TextBox ID="Textiseexam" runat="server"></asp:TextBox>
                    <asp:TextBox ID="Textid" runat="server"></asp:TextBox>
                    <asp:TextBox ID="Textg" runat="server"></asp:TextBox>
                    <asp:TextBox ID="TextName" runat="server"></asp:TextBox>
                    <asp:TextBox ID="TextClassType" runat="server"></asp:TextBox>
                </div></div></div>
    </form>
</body>
</html>
<script language="javascript">
    <%
        int index =0;

        Response.Write("var yearsel = document.getElementById('yearSelect');var oOption;");
       
        foreach (StuExam se in stuExam)
        {
            Response.Write("exams[" + index + "]={examType:" + se.examType + ",examID:"+se.examID+",examName:'" + se.examName + "',schoolYear:" + se.schoolYear + ",grade:"+se.grade+",ClassType:"+se.classType+"};");
            index++;
        }
         index =0;
        bool first= true;
        foreach (int i in schoolYear)
        {
            Response.Write("oOption = document.createElement(\"OPTION\");");
            Response.Write("oOption.text ='" + i + "';");
            Response.Write("oOption.value ='" + i + "';");
            if(first)
            {
                Response.Write("oOption.selected = true;onYearSelect("+i+");");
            }
            else
            {
                Response.Write("oOption.selected = false;");
            }
            Response.Write("yearsel.add(oOption);");
        }
Response.Write(" OnSelectView();");


     %>
</script>